﻿<shared:PageBase x:Class="Miris.HumanMilkAnalyser.WPF.FurtherSuggestionPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Miris.HumanMilkAnalyser.WPF.Shared"
      xmlns:validationRule="clr-namespace:Miris.HumanMilkAnalyser.WPF.ValidationRules"
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="580" d:DesignWidth="1160"
	  Title="FurtherSuggestionPage" Style="{StaticResource DefaultPageStyle}" 
      DataContext="{Binding FurtherSuggestion, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid HorizontalAlignment="Center">
        <Grid.ColumnDefinitions>
            <!-- Back Button -->
            <ColumnDefinition Width="Auto" />
            <!-- Main Content -->
            <ColumnDefinition Width="Auto" />
            <!-- Next Button -->
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Button Margin="0,0,30,0" Width="47" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource OpacityImageButton}" Click="ButtonReturn_Click" />
        <!-- Trasparent effect Background -->
        <Border Grid.Column="1" Style="{StaticResource PageContentContainerBorder}">
            <Border Style="{StaticResource PageContentBackgroundBorder}" />
        </Border>
        <Grid Grid.Column="1" Width="1050" Height="550">
            <Grid.RowDefinitions>
                <!-- Page Title -->
                <RowDefinition Height="55" />
                <!-- Data Management Functions -->
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="自定义建议" Margin="0,15,40,0" HorizontalAlignment="Center" Style="{StaticResource PageTitleTextBlock}" />
            <Grid Grid.Row="1" Margin="20,0,20,0" Height="500">
                <Grid.RowDefinitions>
                    <!-- Setup Sections -->
                    <RowDefinition Height="Auto" />
                    <!-- Save & Cancel buttons -->
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Border Margin="0,0,0,15" Style="{StaticResource OperationPortionBorder}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <!-- Item Usage & Dietary Recommendation -->
                                <RowDefinition Height="Auto" />
                                <!-- Separator -->
                                <RowDefinition Height="10" />
                                <!-- Significance of breastfeeding -->
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <!-- Analysis Item List -->
                                    <ColumnDefinition Width="150" />
                                    <!-- Item Usage -->
                                    <ColumnDefinition Width="417" />
                                    <!-- Dietary Recommendation -->
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <!-- Label -->
                                    <RowDefinition />
                                    <!-- Input -->
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <TextBlock Text="指标名称" Style="{StaticResource RegularTextBlock}" />
                                <TextBlock Grid.Column="1" Text="指标作用" Style="{StaticResource RegularTextBlock}" />
                                <ComboBox Grid.Row="1" ItemsSource="{Binding AnalysisItemList}" DisplayMemberPath="ItemTitle" SelectedValuePath="ItemName" 
                                          SelectedItem="{Binding SelectedAnalysisItem, UpdateSourceTrigger=PropertyChanged}" 
                                          FontSize="22" Style="{StaticResource DefaultComoBox}" />
                                <StackPanel Grid.Column="1" Grid.Row="1">
                                    <TextBox x:Name="TxtAnalysisItemUsage" TextWrapping="Wrap" MaxLength="22" VerticalContentAlignment="Top"
                                             Width="400" Height="60" Style="{StaticResource InfoTextBox}">
                                        <TextBox.Text>
                                            <Binding Path="SelectedAnalysisItem.ItemUsage">
                                                <Binding.ValidationRules>
                                                    <validationRule:AnalysisItemUsageValidationRule />
                                                </Binding.ValidationRules>
                                            </Binding>
                                        </TextBox.Text>
                                    </TextBox>
                                    <TextBlock Margin="0,2,0,0" Style="{StaticResource WhiteTextBlock}">
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0}/{1}" UpdateSourceTrigger="PropertyChanged">
                                                <Binding ElementName="TxtAnalysisItemUsage" Path="Text.Length" />
                                                <Binding ElementName="TxtAnalysisItemUsage" Path="MaxLength" />
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </StackPanel>
                                <TextBlock Grid.Column="2" Text="饮食建议" Style="{StaticResource RegularTextBlock}" />
                                <StackPanel Grid.Column="2" Grid.Row="1">
                                    <TextBox x:Name="TxtAnalysisItemDietaryRecommendation" MaxLength="72" VerticalContentAlignment="Top"
                                             TextWrapping="Wrap" Width="400" Height="60" Style="{StaticResource InfoTextBox}">
                                        <TextBox.Text>
                                            <Binding Path="SelectedAnalysisItem.DietaryRecommendation">
                                                <Binding.ValidationRules>
                                                    <validationRule:AnalysisItemDietaryRecommendationValidationRule />
                                                </Binding.ValidationRules>
                                            </Binding>
                                        </TextBox.Text>
                                    </TextBox>
                                    <TextBlock Margin="0,2,0,0" Style="{StaticResource WhiteTextBlock}">
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0}/{1}" UpdateSourceTrigger="PropertyChanged">
                                                <Binding ElementName="TxtAnalysisItemDietaryRecommendation" Path="Text.Length" />
                                                <Binding ElementName="TxtAnalysisItemDietaryRecommendation" Path="MaxLength" />
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </StackPanel>
                            </Grid>
                            <StackPanel Grid.Row="2">
                                <Separator Margin="0,0,0,10" />
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="标题：" Margin="0,0,2,0" VerticalAlignment="Center" Style="{StaticResource RegularTextBlock}" />
                                    <TextBox Grid.Column="1" x:Name="TxtBreastfeedingSignificanceTitle" MaxLength="20" Width="900" Height="35" Style="{StaticResource InfoTextBox}">
                                        <TextBox.Text>
                                            <Binding Path="CurrentBreastfeedingSignificance.Title">
                                                <Binding.ValidationRules>
                                                    <validationRule:BreastfeedingSignificanceTitleValidationRule />
                                                </Binding.ValidationRules>
                                            </Binding>
                                        </TextBox.Text>
                                    </TextBox>
                                    <TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource WhiteTextBlock}">
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0}/{1}" UpdateSourceTrigger="PropertyChanged">
                                                <Binding ElementName="TxtBreastfeedingSignificanceTitle" Path="Text.Length" />
                                                <Binding ElementName="TxtBreastfeedingSignificanceTitle" Path="MaxLength" />
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </Grid>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="内容：" Margin="0,0,2,0" VerticalAlignment="Top" Style="{StaticResource RegularTextBlock}" />
                                    <TextBox Grid.Column="1" x:Name="TxtBreastfeedingSignificanceContent" Margin="0,10,0,0" AcceptsReturn="True" Width="900" Height="150" 
                                         MaxLength="1300" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" 
                                         Style="{StaticResource InfoTextBox}">
                                        <TextBox.Text>
                                            <Binding Path="CurrentBreastfeedingSignificance.SignificanceContent">
                                                <Binding.ValidationRules>
                                                    <validationRule:BreastfeedingSignificanceContentValidationRule />
                                                </Binding.ValidationRules>
                                            </Binding>
                                        </TextBox.Text>
                                    </TextBox>
                                    <TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource WhiteTextBlock}">
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0}/{1}" UpdateSourceTrigger="PropertyChanged">
                                                <Binding ElementName="TxtBreastfeedingSignificanceContent" Path="Text.Length" />
                                                <Binding ElementName="TxtBreastfeedingSignificanceContent" Path="MaxLength" />
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </Grid>
                            </StackPanel>
                        </Grid>
                    </Border>
                </Grid>
                <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
                    <Button Content="保存并返回" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Save.png" Style="{StaticResource NavigationButton}" Command="{Binding SaveCommand}" />
                    <Button Content="取消并返回" Tag="/Skins/Resource/Image/Cancel.png" Style="{StaticResource NavigationButton}" Click="ButtonCancel_Click" />
                </StackPanel>
            </Grid>
        </Grid>
        <Button Grid.Column="2" Margin="30,0,0,0" Width="47" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource OpacityImageButton}" Visibility="Hidden" />
    </Grid>
</shared:PageBase>
